//
//  AttenZTTableViewCell.m
//  app001
//
//  Created by xionghao on 15/10/8.
//  Copyright © 2015年 xionghao. All rights reserved.
//

#import "AttenZTTableViewCell.h"
#import "ZTAttenCar.h"
#import <UIImageView+WebCache.h>


@implementation AttenZTTableViewCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *Id=@"attenzt";
    
    AttenZTTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:Id];
    if (cell==nil) {
        [tableView registerNib:[UINib nibWithNibName:NSStringFromClass([self class]) bundle:nil] forCellReuseIdentifier:Id];
        cell=[tableView dequeueReusableCellWithIdentifier:Id];
    }
    return cell;
}

-(void)setMode:(ZTAttenCar *)mode{
    _mode=mode;
    self.editbtn.selected=_mode.ischecked;
    [self.icon sd_setImageWithURL:[NSURL URLWithString:[NSString getImageURLstr:_mode.user_ico]] placeholderImage:[UIImage imageNamed:@"usericon_placehoder"]];
    self.titlelabel.text=_mode.name;
    self.msglable.text=_mode.msg;
    
}

-(void)setIsShowAdress:(BOOL)isShowAdress{
    _isShowAdress=isShowAdress;
    self.adresswidth.constant=84;
    self.addresslable.hidden=NO;
}
-(void)setIsEditing:(BOOL)isEditing{
    _isEditing=isEditing;
    self.editbtn.hidden=_isEditing;
    if (!_isEditing) {
        self.accessoryType=UITableViewCellAccessoryNone;
    }else{
        self.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    }
}

- (void)awakeFromNib {
    // Initialization code
    self.icon.layer.cornerRadius=self.icon.width/2;
    self.icon.layer.borderColor=[bgGarycolor CGColor];
    self.icon.layer.borderWidth=0.5;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
